import {getRequest, postRequest, putRequest, deleteRequest, uploadFileRequest,postRequest2} from '@/utils/api';


/**
 * 获取报表信息
 */
export const getReoprtInfo = () => fetch('/report/test');

/**
 * 获取数据源列表信息
 */
export const getDataSourceList = () => postRequest2('/datasource/listdataSource');
/**
 * 获取树形报表结构
 * @returns {Promise<Response>}
 */
export const getTreeList = data => postRequest('/reportCategory/getTreeList', data);
export const addTreeNode = data => postRequest('/reportCategory/addTreeNode', data);
export const delTreeNode = data => postRequest('/reportCategory/delTreeNode', data);
export const updateTreeNode = data => postRequest('/reportCategory/updateTreeNode', data);
export const getReportList = data => postRequest('/reportCategory/getReportList', data);
export const publishReport = data => postRequest('/reportCategory/publishReport', data);
export const publishMerge = data => postRequest('/reportCategory/publishMerge', data);
export const delReport = data => postRequest('/reportCategory/delReport', data);
export const getServiceInterfaceList = data => postRequest('/serviceInterface/getServiceInterfaceList', data);

/**
 * 执行sql
 */
export const execSqlText = data => postRequest('/designer/execSqlText', data);

export const addReport = data => postRequest('/designer/add', data);
export const updateReport = data => postRequest('/designer/update', data);
export const previewReport = data => postRequest('/designer/previewReport', data);

export const getTableData = data => postRequest('/report/table/getData', data);

/**
 *数据源
 */

export const DataSourceList=data=>postRequest2('/datasource/list',data);

export const addDataSource=data=>postRequest('/datasource/add',data);

export const editDataSource=data=>postRequest('/datasource/edit',data);

export const deleteDataSource=data=>postRequest('/datasource/delete',data);

export const testConnectDataSource=data=>postRequest('/datasource/testConnect',data);

/**
 * 图表
 */
export const DashboardList=()=>postRequest2('/dashboard/dashboard');

export const ErrAndSuessByTime=data=>postRequest2('/dashboard/time',data);

export const DashboardListForLine=()=>postRequest2('/dashboard/lines');
/**
 * 获取所有用户和角色
 */
export const getUserAndRoleList = data => postRequest('/reportUserRole/getUserAndRoleList', data);

export const setUserAndRole = data => postRequest('/reportUserRole/setUserAndRole', data);

export const getReportPermission = data => postRequest('/reportUserRole/getReportPermission', data);
/**
 * 查询报表数据
 */
export const queryMid = data => postRequest('/report/queryMid', data);

export const createMidExcel = data => postRequest('/report/createMidExcel', data);
//获取中间表最大账期
export const searchMidBill = data => postRequest('/report/searchMidBill', data);



